﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SARControlLib
{
    /// <summary>
    /// SARViewSwitcher.xaml 的交互逻辑
    /// </summary>
    public partial class SARViewSwitcher : UserControl
    {
        public SARViewSwitcher()
        {
            this.InitializeComponent();
        }

        public event MouseButtonEventHandler SARClick;

        private string m_text;

        public string SARText
        {
            get { return m_text; }
            set
            {
                m_text = value;
                textblock.Text = value;
            }
        }


        private bool isSelected;

        public bool SARIsSelected
        {
            get { return isSelected; }
            set
            {
                isSelected = value;
                if (value)
                {
                    blureffect.Opacity = 1;
                    back1.Opacity = 1;
                }
                else
                {
                    blureffect.Opacity = 0;
                    back1.Opacity = 0;
                }

            }
        }

        private void mouse_MouseLeave(object sender, MouseEventArgs e)
        {
            text.Margin = new Thickness(15, 5, 0, 0);
        }

        private void mouse_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            text.Margin = new Thickness(15, 5, 0, 0);
        }

        private void mouse_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            text.Margin = new Thickness(16, 6, 0, 0);

            if (SARClick != null)
            {
                SARClick.Invoke(this, e);
            }
        }
    }
}